package leetcode_day._2021._202108._1120;

/**
 * @author yzh
 * @version 1.0
 * @date 2021/8/17 20:45
 * 学生出勤记录 I
 * 算法：字符串
 */
public class _17_551 {

    public boolean checkRecord(String s) {
        int a = 0, p = 0;
        for (char c : s.toCharArray()) {
            if (c == 'A') ++a;
            if (c == 'L') {
                ++p;
                if (p == 3) return false;
            }
            else p = 0;
        }
        return a < 2 && p < 3;
    }

}
